package com.lg.partition6;

import java.io.*;

/**
 * @author `RKC`
 * @date 2022/6/5 9:22
 */
public class UVA529AdditionChains {

    private static final int N = 110;
    private static int[] path = new int[N];
    private static int n;

    private static StreamTokenizer tokenizer = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
    private static PrintWriter writer = new PrintWriter(new OutputStreamWriter(System.out));

    public static void main(String[] args) throws IOException {
        path[0] = 1;
        while (true) {
            n = nextInt();
            if (n == 0) break;
            int maxd = 1;
            while (!dfs(1, maxd)) maxd++;
            for (int i = 0; i < maxd; i++) writer.format("%d ", path[i]);
            writer.println();
        }
        writer.flush();
    }

    private static boolean dfs(int d, int maxd) {
        if (d > maxd) return false;
        if (path[d - 1] == n) return true;
        boolean[] st = new boolean[N];
        for (int i = d - 1; i >= 0; i--) {
            for (int j = i; j >= 0; j--) {
                int s = path[i] + path[j];
                if (s > n || st[s] || s < path[d - 1]) continue;
                st[s] = true;
                path[d] = s;
                if (dfs(d + 1, maxd)) return true;
            }
        }
        return false;
    }

    private static int nextInt() throws IOException {
        tokenizer.nextToken();
        return (int) tokenizer.nval;
    }
}
